/*遇见setTimeout回调*/
console.log("第一步");
let promise2 = new Promise((resolve, reject) => {
    console.log('第二步')
    setTimeout(() => {
        resolve('这次一定');
        console.log('第四步');
    });
});

promise2.then(result => {
    console.log(result)
});
console.log('第三步');


let promise = new Promise((resolve, reject) => {
    throw new Error('出错了');
})
/*能够捕获错误*/
promise.then(res => {
    console.log(res);
}, reason => {
    console.log(reason.message)
})